import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { render } from '@apps/antd-admin/src/hooks/render/renderUtils';
import { RenderType } from '@pkg/setting';

export const columns: BasicColumn[] = [
  {
    title: '支付方式名称',
    dataIndex: 'paywayName',
    width: 200,
  },
  {
    title: '图标',
    dataIndex: 'paywayIcon',
    width: 80,
    customRender: render.renderImage,
  },
  {
    title: '支付编码',
    dataIndex: 'paywayCode',
    width: 200,
  },
  {
    title: '是否展示',
    dataIndex: 'isShow',
    width: 60,
    dictData: [
      { label: '不展示', value: 0 },
      { label: '展示', value: 1 },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '排序',
    dataIndex: 'sort',
    width: 200,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'paywayName',
    label: '支付方式名称',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'isShow',
    label: '是否展示',
    component: 'Select',
    colProps: { span: 5 },
    componentProps: {
      options: [
        { label: '不展示', value: 0 },
        { label: '展示', value: 1 },
      ],
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '支付方式名称',
    field: 'paywayName',
    component: 'Input',
    required: true,
  },
  {
    label: '线下支付编码',
    field: 'paywayCode',
    component: 'Input',
    required: true,
  },
  {
    field: 'isShow',
    label: '是否展示',
    component: 'Select',
    componentProps: {
      options: [
        { label: '不展示', value: 0 },
        { label: '展示', value: 1 },
      ],
    },
  },
  {
    label: '排序',
    field: 'sort',
    component: 'InputNumber',
    required: true,
  },
  {
    label: '支付方式图标',
    field: 'paywayIcon',
    component: 'ImageUpload',
    required: true,
  },
];
